New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance of element handling #1601
Conversation
…inal in etab (GetMass).
… need for the second.
Updated timings, for the record, with 3 signif figures and 10x more iterations: Timing comparison: get the symbol for elements 1 to 100 and convert back to atomic number (repeat x100000). 8.05s old vs 0.187s new. A more realistic conversion is to just do carbon: 1.34s old vs 0.078s new. |
Good to merge? Or not...? |
Yep, it looks good. Sorry for the delay |
Could you show me how to use import openbabel
etab = openbabel.OBElementTable()
print(etab.GetSymbol(6)) |
… On Sun, 9 Jun 2019, 09:40 Naruki Yoshikawa, ***@***.***> wrote:
Could you show me how to use OBElements in Python binding?
For example, how can I replace the following code?
import openbabel
etab = openbabel.OBElementTable()print(etab.GetSymbol(6))
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1601?email_source=notifications&email_token=AAALCGIO35247YSN4P4PXBTPZS6YVA5CNFSM4DS2IKEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXIGFSY#issuecomment-500196043>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAALCGOZ5ZS4BQMBAPYU5QDPZS6YVANCNFSM4DS2IKEA>
.
|
I tried the following from openbabel import openbabel
print(openbabel.OBElements.GetSymbol(6)) but it yielded the followng error.
|
Just GetSymbol will work without the OBElements.
…On Sun, 9 Jun 2019, 10:30 Naruki Yoshikawa, ***@***.***> wrote:
I tried the following test.py in the current master,
from openbabel import openbabel
print(openbabel.OBElements.GetSymbol(6))
but it yielded the followng error.
$ python3 test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
print(openbabel.OBElements.GetSymbol(6))
AttributeError: module 'openbabel.openbabel' has no attribute 'OBElements'
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1601?email_source=notifications&email_token=AAALCGIMJBQYZF7WH4HAFBLPZTETHA5CNFSM4DS2IKEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXIGZPI#issuecomment-500198589>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAALCGODS2U3OMT37K6KUVTPZTETHANCNFSM4DS2IKEA>
.
|
As described over at openbabel/enhancement-proposals#4.
Briefly, the old element handling code had some performance problems. I have written a faster replacement. It has the following additional benefits:
Timing comparison: get the symbol for elements 1 to 100 and convert back to atomic number (repeat x10000). 0.82s old vs 0.02s new. A more realistic conversion is to just do carbon: 0.14s old vs 0.01s new.